<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
        integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <title>{% block title %}highlight_table{% endblock %}</title>
</head>
<body>
    {% block content%}
        <h1 class="ml-3 mt-3">Highlights</h1>
        <ul class="list-group list-group-flush">
            {% for test_mode in expected_test_mode %}
                <li class="list-group-item">
                    {% if expected_test_mode|length > 1 %}
                        <h3><span class="mr-3">&#9679</span>{{ test_mode }}</h3>
                    {% endif %} 
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th class="table-dark">Plugins</th>
                                {% for device in devices %}
                                    <th class="table-dark">{{ device }}</th>
                                {% endfor %}
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td class="table-primary">Total ops pass:</td>
                                {% for device in devices %}
                                    <td>
                                        {% if device in ops_info[test_mode] %}
                                            <!-- 10(+3)/(205)(-10) -->
                                            {{ ops_info[test_mode][device]['totalPass'] }}
                                            {% if ops_info[test_mode][device]['diffTotalPass'] > 0 %}
                                                (<span class="text-success font-weight-bold">+{{ ops_info[test_mode][device]['diffTotalPass'] }}</span>)
                                            {% elif ops_info[test_mode][device]['diffTotalPass'] < 0 %}
                                                (<span class="text-danger font-weight-bold">{{ ops_info[test_mode][device]['diffTotalPass'] }}</span>)
                                            {% endif %}
                                            /{{ ops_info[test_mode][device]['totalAmount'] }}
                                            {% if ops_info[test_mode][device]['diffTotalAmount'] > 0 %}
                                                (<span class="text-success font-weight-bold">+{{ ops_info[test_mode][device]['diffTotalAmount'] }}</span>)
                                            {% elif ops_info[test_mode][device]['diffTotalAmount'] < 0 %}
                                                (<span class="text-danger font-weight-bold">{{ ops_info[test_mode][device]['diffTotalAmount'] }}</span>)
                                            {% endif %}
                                        {% else %}
                                            NOT RUN
                                        {% endif %}
                                    </td>
                                {% endfor %}
                            </tr>
                            <tr>
                                <td class="table-primary">Passrate:</td>
                                {% for device in devices %}
                                    <td>
                                        {% if device in general_pass_rate[test_mode] %}
                                            {{ general_pass_rate[test_mode][device]['current'] }}
                                            {% if general_pass_rate[test_mode][device]['prev'] > 0 %}
                                                (<span class="text-success font-weight-bold">+{{ general_pass_rate[test_mode][device]['prev'] }}</span>)
                                            {% elif general_pass_rate[test_mode][device]['prev'] < 0 %}
                                                (<span class="text-danger font-weight-bold">{{ general_pass_rate[test_mode][device]['prev'] }}</span>)
                                            {% endif %}
                                            %
                                        {% else %}
                                            NOT RUN
                                        {% endif %}
                                    </td>
                                {% endfor %}
                            </tr>

                        </tbody>
                    </table>
                </li>
            {% endfor %}
            {% if api_info.keys()|length > 0 %}
                <li class="list-group-item">
                    <h3><span class="mr-3">&#9679</span> API </h3>
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th class="table-dark">Plugins</th>
                                <th class="table-dark">SW Plugins</th>
                                {% for device in devices %}
                                    <th class="table-dark">{{ device }}</th>
                                {% endfor %}
                            </tr>
                        </thead>
                        <tbody>
                            {% for test_type in api_info %}
                                <td class="table-primary" rowspan="{{ api_info[test_type].keys()|length + 1 }}">{{ test_type }}</td>
                            
                                {% for sw_plugin in sw_plugins %}
                                    <tr>
                                        <td>{{sw_plugin}}</td>
                                        {% for device in devices %}
                                            {% if device in api_info[test_type][sw_plugin] %}
                                                <td>
                                                    {{ api_info[test_type][sw_plugin][device]['passrate'] }}
                                                    {% if api_info[test_type][sw_plugin][device]['diff'] > 0 %}
                                                        (<span class="text-success font-weight-bold">+{{ api_info[test_type][sw_plugin][device]['diff'] }}</span>)
                                                    {% elif api_info[test_type][sw_plugin][device]['diff'] < 0 %}
                                                        (<span class="text-danger font-weight-bold">{{ api_info[test_type][sw_plugin][device]['diff'] }}</span>)
                                                    {% endif %}
                                                    %
                                                </td>
                                            {% else %}
                                                <td>NOT RUN</td>
                                            {% endif %}
                                        {% endfor %}
                                    </tr>
                                {% endfor %}    
                            {% endfor %}
                        </tbody>
                    </table>
                </li>
            {% endif %}
        </ul>
    {% endblock %}
</body>
</html>